/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jobscheduling.algorithms.bee;

import java.util.Map;
import java.util.TreeMap;
import jobscheduling.algorithms.AbstractScheduler;
import jobscheduling.algorithms.ResultListener;

/**
 *
 * @author Dawid
 */
public class BeeScheduler extends AbstractScheduler {
    private static final Map<String, String> _params = new TreeMap<String, String>();
    private static final Map<String, String> _descs = new TreeMap<String, String>();
    
    static {
        _params.put("cycleCount", "1000"); 
        _params.put("foodSourcesNumber", "120"); 
        _params.put("onlookerBeesNumber", "240"); 
        _params.put("scoutBeesCount", "24"); 
        _params.put("mutateMode", "4"); 
        _params.put("ifLocalSearch", "0"); 
        _params.put("scoutMode", "0"); 
        
        _descs.put("cycleCount", "Cycle count"); 
        _descs.put("foodSourcesNumber", "Food sources count == count of employed Bees which search food"); 
        _descs.put("onlookerBeesNumber", "Count of onlooker Bees - they search for better solution in solution neighbour, onlookerBeesNumber= 2*employedBees"); 
        _descs.put("scoutBeesCount", "Every scout Bee delete the worst solution and find random one, scoutBeesCount = 0,2*employedBees"); 
        _descs.put("mutateMode", "Mode od solution neighbour finding: 0 - one swap, 1 - one insert, 2 - two swaps, 3 - two inserts, 4 - random change mode in every mutation"); 
        _descs.put("ifLocalSearch", "Turn ON/OFF local search in neighbour finding, 0- ON, 1 - OF (makes the the computing time extreme long =])");  
        _descs.put("scoutMode", "Specifies the the deleting criteria mode: 0-solution with the worst time, 1-solution which is have the biggest cycles without any quality progress- 0 is preferred"); 
    }
    
    public BeeScheduler (int[][] jobList, ResultListener listener, 
                             Map<String, String> params){
        super(jobList, listener, params);
    }
    
    public static Map<String, String> getParamsPresets() {
        return _params;
    }

    public static Map<String, String> getParamsDescs() {
        return _descs;
    }

    @Override
    public boolean isCorrect(String parameter, String value) {
        return true;
    }
    
    @Override
    public void run(){
    	BeeColony bee = new BeeColony(_jobs, _result, _parameters);
    	bee.optimize();
    }
}
